<?php

namespace Topxia\Service\Kuke\Dao\Impl;

use Topxia\Service\Common\BaseDao;
use Topxia\Service\Kuke\Dao\UserDao;

class UserDaoImpl extends BaseDao implements UserDao
{
    protected $table = 'user';

    public function getnum()
    {
		$res = array();
        $sql = "SELECT count(id) as num FROM {$this->table} WHERE roles like '%ROLE_TEACHER%' and locked = 0";
		$res['teacher'] = $this->getConnection()->fetchColumn($sql) ? : null;
        $sql = "SELECT count(id) as num FROM {$this->table} WHERE roles like '%ROLE_USER%' and locked = 0";
		$res['user'] = $this->getConnection()->fetchColumn($sql) ? : null;
		return $res;
    }
}